<!DOCTYPE html>
<html layout:decorate="~{layout}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout">

<head>
    <meta content="IE=edge" http-equiv="X-UA-Compatible"/>
    <meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport"/>

    <title th:text="#{cas.mfa.simple.pagetitle}">CAS Multifactor Authentication View</title>
    <link href="../../static/css/cas.css" rel="stylesheet" th:remove="tag"/>
</head>

<body>
<main class="container mt-3 mb-3" role="main">
    <div class="mdc-card mdc-card-content w-lg-50 p-4 m-auto" id="login" layout:fragment="content">
        <form id="fm1" method="post" th:action="@{/login}" th:object="${credential}">

            <div class="banner banner-danger my-2" th:if="${flowRequestContext.messageContext.hasErrorMessages()}">
                <p th:each="message : ${flowRequestContext.messageContext.allMessages}"
                   th:utext="#{${message.text}}">Message Text</p>
            </div>

            <div class="banner banner-info my-2"
                 th:unless="${flowRequestContext.messageContext.hasErrorMessages()}">
                <p th:each="message : ${flowRequestContext.messageContext.allMessages}"
                   th:utext="#{${message.text}}">Message Text</p>
            </div>

            <section class="cas-field my-3 mdc-input-group">
                <div class="mdc-input-group-field mdc-input-group-field-append">
                    <div
                            class="mdc-text-field  mdc-text-field--with-trailing-icon d-flex caps-check">
                        <input autocomplete="off" class="mdc-text-field__input pwd" id="token" required size="25"
                               th:accesskey="#{screen.welcome.label.password.accesskey}" th:field="*{token}"
                               type="password"/>
                        <label class="mdc-floating-label" for="token"
                               th:utext="#{cas.mfa.simple.label.token}">Token</label>
                    </div>
                    <div class="mdc-text-field-helper-line caps-warn">
                        <p
                                class="mdc-text-field-helper-text mdc-text-field-helper-text--persistent mdc-text-field-helper-text--validation-msg text-danger">
                            <span th:utext="#{screen.capslock.on}"/>
                        </p>
                    </div>
                </div>
                <button class="reveal-password mdc-button mdc-button--raised mdc-input-group-append mdc-icon-button"
                        type="button">
                    <i class="mdi mdi-eye reveal-password-icon"></i>
                    <span class="sr-only">Toggle Password</span>
                </button>
            </section>
            <div class="d-flex">
                <button accesskey="s" class="mdc-button mdc-button--raised mr-2">
                    <span class="mdc-button__label" th:text="#{screen.welcome.button.login}">Login</span>
                </button>
                <button class="mdc-button mdc-button--raised" name="resend" onclick="$('#eventId').val('resend');">
                    <span class="mdc-button__label" th:text="#{cas.mfa.simple.label.resend}">Resend</span>
                </button>
            </div>
            <input id="eventId" name="_eventId" type="hidden" value="submit"/>
            <input name="execution" th:value="${flowExecutionKey}" type="hidden"/>
            <input name="geolocation" type="hidden"/>
        </form>
    </div>
</main>
</body>

</html>